<template>
  <div class="collect-page">
    <!-- 收藏页 -->
    <van-nav-bar
      title="收藏列表"
      left-arrow
      @click-left="$router.push('/my')"
    />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >

       <MyrentVue v-for="(item, index) in list" :key="index"
      :item ="item"
      ></MyrentVue>
    </van-list>

  </div>
</template>

<script>
import { getCollect } from '@/api/user'
import MyrentVue from '@/components/MyrentVue'
export default {
  name: 'collect-list',
  components: { MyrentVue },
  data () {
    return {
      list: [],
      loading: false,
      finished: false
    }
  },
  methods: {
    async onLoad () {
      const { body } = await getCollect()
      this.list.push(...body)// 将请求的数据新增到数组里
      this.finished = true
    }
  }
}
</script>

<style lang="less" scoped>
.title {
  background-color:#1cb680;
  padding-right: 20px;
  text-align: center;
  top: 0;
  left: 0;
  width: 100%;
  height: 46px;
}
::v-deep .van-icon, .van-icon-arrow-left, .van-nav-bar__arrow {
  color: #fff;
}
::v-deep .van-nav-bar__title, .van-ellipsis {
  color: #fff;
  font-size: 18px;
  text-align: center;
}
</style>
